home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 300_01 / econ_plt.doc < prev    next >
Text File  |  1989-12-28  |  7KB  |  147 lines

  1.  
  2.  
  3.                     DOCUMENTATION FOR ECON_PLT
  4.  
  5.  
  6. PURPOSE:  This program provides Z_chart plots of any data that is 
  7. appropriately plotted against dates along the abcissa (x-axis). Input 
  8. data is in the form of a table of values to be plotted. The first column 
  9. is the date and a separate plot is provided for each consecutive column 
  10. of values. 
  11.  
  12. REFERENCE: "Marketing and Sales Forcasting Manual", by Gordon J. Bolt, 
  13. Prentice Hall, Second edition May, 1973.
  14.  
  15. GENERAL PROGRAM DESCRIPTION: The Z-chart is a forcasting tool. Trends 
  16. can be deduced from the shape of the curve. It is a line chart which 
  17. plots three different lines using the same periodic data. A moving 
  18. average total, a cumulative total, and the period data values are all 
  19. plotted on a single chart. The name for the chart arises from the 
  20. rough shape of the three lines plotted. With the number of periods (N) 
  21. along the x-axis, the top line of the 'Z' is the moving average total 
  22. for N periods. The diagonal line of the 'Z' is the cumulative total 
  23. for the last N periods of the data set, and the bottom line of the 'Z' 
  24. is formed by plotting a the actual per period data values. Note that 
  25. the last moving average total value plotted and the last cumulative 
  26. value plotted have the same value so that both lines meet at the upper 
  27. right corner of the 'Z'. 
  28.  
  29. The upper line is the long term trend and indicates a rise if the line is 
  30. hooking upward, the diagonal line shape (upward hooking suggests a rising 
  31. trend) indicates the short term trend, and the bottom line can be 
  32. examined to cyclic variations.
  33.  
  34. To generate a 'Z' chart, the user prepares an ASCII text containing all 
  35. of the data to be plotted. Comments may be embedded in the textfile as 
  36. long as they are enclosed in curly braces. The dates are in the form, 
  37. yymmdd (year month date), so they can be easily sorted into date 
  38. sequence prior to plotting using the MSDOS sort function. The  dates 
  39. are placed in the first column, and each suceeding column contains the 
  40. the data for each 'Z' chart to be plotted. A column title is placed 
  41. above each column. The column title appears on the Z-chart when it is 
  42. plotted. 
  43.  
  44.  
  45. Here is an example input file named <INPUT.INP>
  46.  
  47.  
  48. { Typical Weather data }
  49.  
  50. DATE     RAINFALL    TEMPERATURE    HUMIDITY
  51.  
  52. 870101   6.0         45.0           40.0
  53. 870201   6.5         38.0           45.0
  54. 870305   4.7         56.0           57.0
  55. 870401   5.7         65.0           60.0
  56. 870501   6.5         72.0           65.0
  57. 870605   4.7         75.0           80.0
  58. 870701   3.9         85.0           75.0
  59. 870801   3.9         88.0           70.0
  60. 870905   4.7         78.0           65.0
  61. 871001   3.2         72.0           60.0
  62. 871101   5.8         65.0           45.0
  63. 871205   4.7         56.0           48.0
  64.  
  65. { End of Data }
  66.  
  67.  
  68. USER INTERFACE DESCRIPTION:  The program is executed by entering 
  69. "ECON_PLT". The user is then prompted for the file name of the input data 
  70. file. The file nane where the data is stored (i.e. INPUT.INP) is then 
  71. entered. The program will then prompt the user for the number of periods 
  72. to be summed for the moving average total and for the cumulative 
  73. totals. Next the 'Z' chart for the first column of data is plotted on 
  74. the screen labeled with the column heading. If graphics.com was run 
  75. befor the ECON_PLT was run you can print a hard copy of the chart using 
  76. the shift-print screen key on Epson compatible graphics printers. The 
  77. next and each suceeding column of data can be viewed by striking the 
  78. space bar. After the last column of data is plotted the program exits to 
  79. the operating system. 
  80.  
  81.  
  82. A. INPUT FILE DESCRIPTION: The ASCII file to be read by CONTOUR.EXE can 
  83. be typed up using a separate text editor. The file must be arranged as 
  84. follows:
  85.  
  86.  
  87. Data                                                             
  88. Line No. Data line description                                                       
  89. -------- ------------------------------------------------------------
  90.  
  91. 1        The first line is a series of column headings for each column. 
  92.          The first column heading should be "DATE".
  93.  
  94. 2        Each suceeding row begins with a date in the yymmdd form and 
  95. .. to .. then each sucessive column contains the periodic value 
  96.   last   corresponding to the column where it appears. The rows must
  97.    row   be in date sequence.
  98.  
  99.  
  100. NOTE: Lines containing only comments or which are blank
  101.       are not counted.                                 
  102.  
  103.  
  104. PROGRAM LIMITATIONS:  This program is not universally applicable to all 
  105. situations encountered. The x-axis is labeled with only by the year and 
  106. the year is in scientific notation. Also if the values fluctuate from 
  107. plus to minus the Z-chart can be difficult to interpret. 
  108.  
  109. The version of the program on the distribution disk require the use of a 
  110. CGA monitor. Object code for Borland's BGI CGA graphics driver is linked 
  111. to the program. 
  112.  
  113. The C-language source code for the charting package (Quin-Curtis' 
  114. Scientific and Engineering Software written is Turbo C) is used by the 
  115. program but is not included because it is proprietary. I recommend the 
  116. package because of it many capabilities and reasonable price. The C-
  117. language source for the main is provided and it demonstrates how easily 
  118. the dynamic arrays can be interfaced to the third party array handling 
  119. packages. The fact that this program is sizeable and that the source 
  120. code is short illustrates the power available using these two libraries 
  121. together.
  122.  
  123.  
  124. VARIABLE DESCRIPTIONS:
  125.  
  126. rows                   : Number of input data rows
  127. cols                   : Number of input data columns
  128. toksize                : Largest input token length
  129. i,j,k,loops            : Loop indexes and boundarys
  130. move_ave               : Moving average
  131. cumul_tot              : Cumulative total
  132. no_pds                 : Number of data points to use for moving 
  133.                          averages and cumulative totals
  134. xtitle[80]             : String to hold plot title
  135. filename[30]           : Character variable to hold input filename
  136. *data                  : Dynamic text array for input data
  137. *headings              : Dynamic text array for plot headings
  138. *date                  : Dynamic text array for dates
  139. *dataf                 : Dynamic float array for input data
  140. *plot_data             : Dynamic float array for plot values
  141. date_min               : Earliest date in data set
  142. date_max               : Latest date in data set
  143. plot_max               : Maximum value to be plotted
  144. plot_min               : Minimum value to be plotted
  145. tic                    : Spacing of tic marks on plot
  146.  
  147.